home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / sun / volume1 / tooltool2.1c / part02 < prev    next >
Encoding:
Internet Message Format  |  1989-06-06  |  46.1 KB

  1. Path: uunet!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!aramis.rutgers.edu!dartagnan.rutgers.edu!mcgrew
  2. From: mcgrew@dartagnan.rutgers.edu (Charles Mcgrew)
  3. Newsgroups: comp.sources.sun
  4. Subject: v01i021:  Tooltool - a suntools user interface builder, Part 02/13
  5. Message-ID: <Jun.7.00.10.00.1989.23482@dartagnan.rutgers.edu>
  6. Date: 7 Jun 89 04:10:03 GMT
  7. Organization: Rutgers Univ., New Brunswick, N.J.
  8. Lines: 1444
  9. Approved: mcgrew@aramis.rutgers.edu
  10.  
  11. Submitted-by: Chuck Musciano <chuck@trantor.harris-atd.com>
  12. Posting-number: Volume 1, Issue 21
  13. Archive-name: tooltool2.1c/part02
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 13)."
  22. # Contents:  func_fix.c samples/README samples/keytool.defaults.uu
  23. #   samples/lpq2.tt samples/top.tt samples/vt100/edtkeys.ras.uu
  24. #   samples/vt100/vt102tool.tt samples/vt100/vtem.c symbols.c
  25. # Wrapped by chuck@melmac on Thu Jun  1 10:39:27 1989
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'func_fix.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'func_fix.c'\"
  29. else
  30. echo shar: Extracting \"'func_fix.c'\" \(5847 characters\)
  31. sed "s/^X//" >'func_fix.c' <<'END_OF_FILE'
  32. X/************************************************************************/
  33. X/*    Copyright 1988 by Chuck Musciano and Harris Corporation        */
  34. X/*                                    */
  35. X/*    Permission to use, copy, modify, and distribute this software    */
  36. X/*    and its documentation for any purpose and without fee is    */
  37. X/*    hereby granted, provided that the above copyright notice    */
  38. X/*    appear in all copies and that both that copyright notice and    */
  39. X/*    this permission notice appear in supporting documentation, and    */
  40. X/*    that the name of Chuck Musciano and Harris Corporation not be    */
  41. X/*    used in advertising or publicity pertaining to distribution    */
  42. X/*    of the software without specific, written prior permission.    */
  43. X/*    Chuck Musciano and Harris Corporation make no representations    */
  44. X/*    about the suitability of this software for any purpose.  It is    */
  45. X/*    provided "as is" without express or implied warranty.        */
  46. X/*                                    */
  47. X/*    The sale of any product based wholely or in part upon the     */
  48. X/*    technology provided by tooltool is strictly forbidden without    */
  49. X/*    specific, prior written permission from Harris Corporation.    */
  50. X/*    Tooltool technology includes, but is not limited to, the source    */
  51. X/*    code, executable binary files, specification language, and    */
  52. X/*    sample specification files.                    */
  53. X/************************************************************************/
  54. X
  55. X#include    <stdio.h>
  56. X
  57. X#include    "tooltool.h"
  58. X
  59. X#define        advance_queue_ptr(q)    ((q) = ((q) + 1) % MAX_EVENTS)
  60. X
  61. X#define        MAX_EVENTS        16
  62. X
  63. Xtypedef    struct    fk_data    fk_rec, *fk_ptr;
  64. X
  65. Xstruct    fk_data    {int    candidate;
  66. X         int    true_event;
  67. X         char    *expansion;
  68. X        };
  69. X
  70. XPRIVATE    Event    event_queue[MAX_EVENTS];
  71. XPRIVATE    Event    saved_event[MAX_EVENTS];
  72. XPRIVATE    int    queue_head = 0;
  73. XPRIVATE    int    queue_tail = 0;
  74. XPRIVATE    int    state = 0;
  75. X
  76. XPRIVATE    fk_rec    func_key[] = {{TRUE, KEY_LEFT(2),   "\033[193z"},
  77. X                  {TRUE, KEY_LEFT(3),   "\033[194z"},
  78. X                  {TRUE, KEY_LEFT(4),   "\033[195z"},
  79. X                  {TRUE, KEY_LEFT(5),   "\033[196z"},
  80. X                  {TRUE, KEY_LEFT(6),   "\033[197z"},
  81. X                  {TRUE, KEY_LEFT(7),   "\033[198z"},
  82. X                  {TRUE, KEY_LEFT(8),   "\033[199z"},
  83. X                  {TRUE, KEY_LEFT(9),   "\033[200z"},
  84. X                  {TRUE, KEY_LEFT(10),  "\033[201z"},
  85. X                  {TRUE, KEY_TOP(1),    "\033[224z"},
  86. X                  {TRUE, KEY_TOP(2),    "\033[225z"},
  87. X                  {TRUE, KEY_TOP(3),    "\033[226z"},
  88. X                  {TRUE, KEY_TOP(4),    "\033[227z"},
  89. X                  {TRUE, KEY_TOP(5),    "\033[228z"},
  90. X                  {TRUE, KEY_TOP(6),    "\033[229z"},
  91. X                  {TRUE, KEY_TOP(7),    "\033[230z"},
  92. X                  {TRUE, KEY_TOP(8),    "\033[231z"},
  93. X                  {TRUE, KEY_TOP(9),    "\033[232z"},
  94. X                  {TRUE, KEY_RIGHT(1),  "\033[208z"},
  95. X                  {TRUE, KEY_RIGHT(2),  "\033[209z"},
  96. X                  {TRUE, KEY_RIGHT(3),  "\033[210z"},
  97. X                  {TRUE, KEY_RIGHT(4),  "\033[211z"},
  98. X                  {TRUE, KEY_RIGHT(5),  "\033[212z"},
  99. X                  {TRUE, KEY_RIGHT(6),  "\033[213z"},
  100. X                  {TRUE, KEY_RIGHT(7),  "\033[214z"},
  101. X                  {TRUE, KEY_RIGHT(8),  "\033[215z"},
  102. X                  {TRUE, KEY_RIGHT(9),  "\033[216z"},
  103. X                  {TRUE, KEY_RIGHT(10), "\033[217z"},
  104. X                  {TRUE, KEY_RIGHT(11), "\033[218z"},
  105. X                  {TRUE, KEY_RIGHT(12), "\033[219z"},
  106. X                  {TRUE, KEY_RIGHT(13), "\033[220z"},
  107. X                  {TRUE, KEY_RIGHT(14), "\033[221z"},
  108. X                  {TRUE, KEY_RIGHT(15), "\033[222z"},
  109. X                  {NULL, NULL,          NULL}};
  110. X
  111. X/************************************************************************/
  112. XPRIVATE    enqueue_event(event)
  113. X
  114. XEvent    *event;
  115. X
  116. X{
  117. X    event_queue[queue_head] = *event;
  118. X    if (advance_queue_ptr(queue_head) == queue_tail)
  119. X       abend("internal event queue overflow");
  120. X}
  121. X
  122. X/************************************************************************/
  123. XPRIVATE    Event    *dequeue_event()
  124. X
  125. X{    Event    *result;
  126. X
  127. X    if (queue_tail == queue_head)
  128. X       return(NULL);
  129. X    result = &(event_queue[queue_tail]);
  130. X    advance_queue_ptr(queue_tail);
  131. X    return(result);
  132. X}
  133. X
  134. X/************************************************************************/
  135. XPRIVATE    reset_state_machine(enqueue_events)
  136. X
  137. Xint    enqueue_events;
  138. X
  139. X{    int    i;
  140. X
  141. X    if (enqueue_events)
  142. X       for (i = 0; i < state; i++)
  143. X          enqueue_event(&(saved_event[i]));
  144. X    for (i = 0; func_key[i].expansion; i++)
  145. X       func_key[i].candidate = TRUE;
  146. X    state = 0;
  147. X}
  148. X
  149. X/************************************************************************/
  150. XPRIVATE    advance_state_machine(event)
  151. X
  152. Xregister    Event    *event;
  153. X
  154. X{    register    int    candidates;
  155. X    register    fk_ptr    last_match, key;
  156. X
  157. X    for (key = func_key, candidates = 0; key->expansion; key++)
  158. X       if (key->candidate && key->expansion[state] == event_id(event)) {
  159. X          candidates++;
  160. X          last_match = key;
  161. X          }
  162. X       else
  163. X          key->candidate = FALSE;
  164. X    if (candidates == 0) {
  165. X       reset_state_machine(TRUE);
  166. X       enqueue_event(event);
  167. X       }
  168. X    else if (candidates == 1 && last_match->expansion[state + 1] == '\0') {
  169. X       event_set_id(event, last_match->true_event);
  170. X       reset_state_machine(FALSE);
  171. X       enqueue_event(event);
  172. X       }
  173. X    else {
  174. X       saved_event[state] = *event;
  175. X       if (++state >= MAX_EVENTS)
  176. X          abend("oveflowed internal event buffer");
  177. X       }
  178. X}
  179. X
  180. X/************************************************************************/
  181. XPRIVATE    Notify_value    function_check(win, event, arg, type)
  182. X
  183. XWindow    win;
  184. XEvent    *event;
  185. XNotify_arg    arg;
  186. XNotify_event_type    type;
  187. X
  188. X{    Notify_value    result;
  189. X
  190. X    if (event_is_ascii(event) || event_is_meta(event))
  191. X       if (event_is_down(event))
  192. X          advance_state_machine(event);
  193. X       else
  194. X          reset_state_machine(TRUE);
  195. X    else {
  196. X       reset_state_machine(TRUE);
  197. X       enqueue_event(event);
  198. X       }
  199. X    while (event = dequeue_event())
  200. X       if ((result = notify_next_event_func(win, event, arg, type)) != NOTIFY_DONE)
  201. X          return(result);
  202. X    return(NOTIFY_DONE);
  203. X}
  204. X
  205. X/************************************************************************/
  206. XEXPORT    init_function_fix(win)
  207. X
  208. XWindow    win;
  209. X
  210. X{
  211. X    window_set(win, WIN_CONSUME_KBD_EVENT,  WIN_UP_ASCII_EVENTS, 0);
  212. X    notify_interpose_event_func(win, function_check, NOTIFY_SAFE);
  213. X}
  214. END_OF_FILE
  215. if test 5847 -ne `wc -c <'func_fix.c'`; then
  216.     echo shar: \"'func_fix.c'\" unpacked with wrong size!
  217. fi
  218. # end of 'func_fix.c'
  219. fi
  220. if test -f 'samples/README' -a "${1}" != "-c" ; then 
  221.   echo shar: Will not clobber existing file \"'samples/README'\"
  222. else
  223. echo shar: Extracting \"'samples/README'\" \(4704 characters\)
  224. sed "s/^X//" >'samples/README' <<'END_OF_FILE'
  225. X     This directory contains several sample tooltool specifications
  226. Xwhich you can use to help learn tooltool.  All files ending in ".tt"
  227. Xare tooltool files.  The samples contained herein are:
  228. X
  229. X    lpq.tt
  230. X    queue.c
  231. X    laserwriter.icon
  232. X        This specification uses a custom application (queue.c)
  233. X        to show how a user could build a new windowed application
  234. X        from scratch using a small C program and a tooltool
  235. X        file.  Compile queue.c (using "cc -O -o queue queue.c")
  236. X        and type "tooltool -f lpq.tt" to see the results.  Lpq.tt
  237. X        creates a windowed print queue monitor which polls the
  238. X        print queue.  Closing the window stops the polling, 
  239. X        opening it restarts it, as do the buttons in the gadget
  240. X        panel.  You can adjust the polling rate using the slider.
  241. X
  242. X    lpq2.tt
  243. X    tty.c
  244. X        This is another queue tool, but written with all the 
  245. X        smarts in the tooltool file itself.  It uses /bin/cat
  246. X        to write to the display.  This is a good example of
  247. X        the new features in tooltool 2.0.
  248. X
  249. X    top.tt
  250. X    top.icon
  251. X        Top.tt turns the popular top command into a windowed
  252. X        application.  Common top commands have been placed on 
  253. X        buttons, and you can still type to top like you used to.
  254. X
  255. X    rn.tt
  256. X    news.icon
  257. X        This turns rn, the news reading program, into a windowed
  258. X        news reading program.  Again, common commands are on
  259. X        buttons, and less used commands are in a menu.  You can 
  260. X        add to or change rn.tt to suit your own tastes, depending
  261. X        on how you like to use rn.
  262. X
  263. X    calc.tt
  264. X        This is the sample file discussed in the documentation.
  265. X        It uses very few tooltool options, and serves as a simple
  266. X        introductory example to tooltool.  You could jazz this up
  267. X        with an icon, and some other buttons to perform other
  268. X        arithmetic operations.
  269. X
  270. X    stopwatch.tt
  271. X    stopwatch.icon
  272. X        This creates a handy stopwatch tool, entirely within tooltool.
  273. X        It can count up or down, can take a split time, and can be set
  274. X        by clicking on the appropriate digits.  It offers tenth or
  275. X        single second resolution.
  276. X
  277. X    keytool
  278. X    keytool.l
  279. X    keytool.r.14
  280. X    keytool.defaults
  281. X        Keytool is a different kind of tooltool application.  It is 
  282. X        actually a shell script, which builds a specification for 
  283. X        tooltool.  It is a good example of how to process command
  284. X        line arguments for a tooltool application, and is a complex
  285. X        example of using tooltool.  Basically, keytool lets you
  286. X        reprogram your keyboard, save those definitions and have them
  287. X        recalled when you next invoke keytool.  To define keys and mouse
  288. X        actions, click shift-control-meta mouse right to see the
  289. X        programming window.  Click on the key (and shift pattern)
  290. X        you want to define, and type the definition.  A typical
  291. X        invocation would be "keytool /bin/csh" to create a shell
  292. X        window with programmable keys.  Since keytool is a shell
  293. X        script, you invoke it directly, instead of using "tooltool -f
  294. X        keytool".  Keytool is courtesy of Ken Laprade, here at Harris.
  295. X        Try it!
  296. X
  297. X        Before using keytool, you must unpack the defaults and font
  298. X        files by typing:
  299. X        
  300. X            uudecode keytool.defaults.uu
  301. X            uudecode keytool.r.14.uu
  302. X        
  303. X        Then you can successfully run keytool.
  304. X        
  305. X        Note that keytool has its own special font, which you should
  306. X        install in /usr/lib/fonts/fixedwidthfonts if you make keytool
  307. X        an installed tool at your site.  Don't forget to fix up the
  308. X        keytool reference to this font when you move it.  The same
  309. X        goes for the keytool.defaults file, which we keep in 
  310. X        /usr/local/lib.
  311. X
  312. X    vt100
  313. X        This directory contains a complete vt100 emulator with a tooltool
  314. X        wrapper.  See the VTEM_README file in this directory for more
  315. X        information.  You'll need to create the emulator before you can use
  316. X        it with tooltool; check the Makefile for the appropriate information.
  317. X
  318. XIn all of these files, references are made to icon files, font files, and
  319. Xapplication names.  If you wish to make these samples real commands, you should
  320. Xput the icons and associated files in a public place and modify the .tt 
  321. Xfile accordingly.  At Harris, we put all .tt files in /usr/local/lib/tooltool,
  322. Xand icons go in /usr/local/images.  The fonts used by these files are Sun
  323. Xstandards, so that should be no problem.  Finally, you should create little
  324. Xshell files to invoke tooltool transparently when the command name is typed:
  325. X
  326. X    lpqtool:
  327. X        tooltool -f /usr/local/lib/tooltool/lpq.tt
  328. X       or
  329. X            tooltool -f /usr/local/lib/tooltool/lpq2.tt
  330. X
  331. X    toptool:
  332. X        tooltool -f /usr/local/lib/tooltool/top.tt
  333. X
  334. X    newstool:
  335. X        tooltool -f /usr/local/lib/tooltool/rn.tt
  336. X
  337. X    calctool:
  338. X        tooltool -f /usr/local/lib/tooltool/calc.tt
  339. X
  340. X    stopwatchtool:
  341. X        tooltool -f /usr/local/lib/tooltool/stopwatch.tt
  342. X
  343. X    supershelltool:
  344. X        keytool /bin/csh
  345. X
  346. XOf course, replace /usr/local/lib/tooltool with the pathname of the place
  347. Xyou keep the tooltool file.
  348. END_OF_FILE
  349. if test 4704 -ne `wc -c <'samples/README'`; then
  350.     echo shar: \"'samples/README'\" unpacked with wrong size!
  351. fi
  352. # end of 'samples/README'
  353. fi
  354. if test -f 'samples/keytool.defaults.uu' -a "${1}" != "-c" ; then 
  355.   echo shar: Will not clobber existing file \"'samples/keytool.defaults.uu'\"
  356. else
  357. echo shar: Extracting \"'samples/keytool.defaults.uu'\" \(2823 characters\)
  358. sed "s/^X//" >'samples/keytool.defaults.uu' <<'END_OF_FILE'
  359. Xbegin 666 keytool.defaults
  360. XM4T5005)!5$]2/0D*4%))34%260I,,@D8$PD5&!,)%1@3"2<G"1MJ?@DG)PDG
  361. XM)PDG)PI,,PD8!@D;,1@&"1LQ& 8))R<)&VHM,1@&"2<G"2<G"2<G"DPT"1AB
  362. XM"1AK"1AK"2<G"1MJ7@DG)PDG)PDG)PI,.0D;:@D;:G@)&VIX"2<G"2<G"2<G
  363. XM"2<G"2<G"DPQ, D;* D;:G@)&VIX"2<G"2<G"2<G"2<G"2<G"D8Q"1MJ"1MJ
  364. XM> D;:G@))R<))R<))R<))R<))R<*1C()&R@)&VIX"1MJ> DG)PDG)PDG)PDG
  365. XM)PDG)PI&,PD;,PDG)PDG)PDG)PDG)PDG)PDG)PDG)PI&- D;:G<))R<))R<)
  366. XM)R<))R<))R<))R<))R<*1C4)&VIX9PD8/0D8/0DG)PDG)PDG)PDG)PDG)PI&
  367. XM-@D;*',)&RAS"1LH<PDG)PDG)PDG)PDG)PDG)PI&-PD;:GAQ( T)&VIX<2!L
  368. XM87-T#0D;:GAQ(&QA<W0-"2<G"2<G"2<G"2<G"2<G"D8X"1D)&VIX;"!T#0D;
  369. XM:GAL('0-"2<G"2<G"2<G"2<G"2<G"D8Y"1MJ>0D;:GAC(&0@#0D;:GAC(&0@
  370. XM#0DG)PDG)PDG)PDG)PDG)PI2,0EY"7D)>0DG)PDG)PDG)PDG)PDG)PI2,@EB
  371. XM"6()8@DG)PDG)PDG)PDG)PDG)PI2,PD!"0$) 0DG)PDG)PDG)PDG)PDG)PI2
  372. XM- D-"0T)#0DG)PDG)PDG)PDG)PDG)PI2-0D@"2 )( DG)PDG)PDG)PDG)PDG
  373. XM)PI2-@D%"04)!0DG)PDG)PDG)PDG)PDG)PI2-PD!"1@H"1@H"2<G"2<G"2<G
  374. XM"2<G"2<G"E(X"1 )&VH\"1MJ/ DG)PDG)PDG)PDG)PDG)PI2.0D%"1@I"1@I
  375. XM"2<G"2<G"2<G"2<G"2<G"E(Q, D""0$)&VH""2<G"2<G"2<G"2<G"2<G"E(Q
  376. XM,0D$"1MJ9!MJ" D;:F0;:@@))R<)&VID"2<G"2<G"2<G"E(Q,@D&"04)&VH&
  377. XM"2<G"2<G"2<G"2<G"2<G"E(Q,PD5&S,)&0D9"2<G"1LS"2<G"2<G"2<G"E(Q
  378. XM- D."1MJ/@D;:CX))R<))R<))R<))R<))R<*4C$U"1@8"1MJ>0D;:GD))R<)
  379. XM& T))R<))R<))R<*3$5&5 DG)PDG)PDG)PDG)PDG)PDG)PDG)PDG)PI-241$
  380. XM3$4))R<))R<))R<))R<))R<))R<))R<))R<*4DE'2%0))R<))R<))R<))R<)
  381. XM)R<))R<))R<))R<*4T5#3TY$05)9"DPR"1@3"148$PD5&!,))R<)&VI^"2<G
  382. XM"2<G"2<G"DPS"1@&"1LQ& 8)&S$8!@DG)PD;:BTQ& 8))R<))R<))R<*3#0)
  383. XM&&()&&L)&&L))R<)&VI>"2<G"2<G"2<G"DPY"1MJ"1MJ> D;:G@))R<))R<)
  384. XM)R<))R<))R<*3#$P"1LH"1MJ> D;:G@))R<))R<))R<))R<))R<*1C$) 1MJ
  385. XM7 @;:EP-&VHR" X) 2\J( 4@+RH@*B\."0%[( 4@>WT."2<G"2<G"2<G"2<G
  386. XM"2<G"D8R"0$;:EP(&VI<#0X) 1MJ,P0%&VHV" X) 1MJ,@0%&VHS" X))R<)
  387. XM)R<))R<))R<))R<*1C,) 1MJ7 @;:EP-(" ."0$O*B %("\J("HO#@D0!1D!
  388. XM&VHQ&0DG)PDG)PDG)PDG)PDG)PI&- D;:EP) 0L9 0\9( D!+RH@!2 O*B J
  389. XM+PX))R<))R<))R<))R<))R<*1C4)&VIX9PD8/0D8/0DG)PDG)PDG)PDG)PDG
  390. XM)PI&-@D;*',)&RAS"1LH<PDG)PDG)PDG)PDG)PDG)PI&-PD;:GAQ( T)&VIX
  391. XM<2!L87-T#0D;:GAQ(&QA<W0-"2<G"2<G"2<G"2<G"2<G"D8X"1D)&VIX;"!T
  392. XM#0D;:GAL('0-"2<G"2<G"2<G"2<G"2<G"D8Y"1MJ>0D;:GAC(&0@#0D;:GAC
  393. XM(&0@#0DG)PDG)PDG)PDG)PDG)PI2,0D;80D;80D;80DG)PDG)PDG)PDG)PDG
  394. XM)PI2,@D;:G8)&VIV"1MJ=@DG)PDG)PDG)PDG)PDG)PI2,PD;:CP)&VH\"1MJ
  395. XM/ DG)PDG)PDG)PDG)PDG)PI2- D;8 D;8 D;8 DG)PDG)PDG)PDG)PDG)PI2
  396. XM-0D6"18)%@DG)PDG)PDG)PDG)PDG)PI2-@D;:CX)&VH^"1MJ/@DG)PDG)PDG
  397. XM)PDG)PDG)PI2-PD!"1@H"1@H"2<G"2<G"2<G"2<G"2<G"E(X"1 )&VH\"1MJ
  398. XM/ DG)PDG)PDG)PDG)PDG)PI2.0D%"1@I"1@I"2<G"2<G"2<G"2<G"2<G"E(Q
  399. XM, D""0$)&VH""2<G"2<G"2<G"2<G"2<G"E(Q,0D$"1MJ9!MJ" D;:F0;:@@)
  400. XM)R<)&VID"2<G"2<G"2<G"E(Q,@D&"04)&VH&"2<G"2<G"2<G"2<G"2<G"E(Q
  401. XM,PD5&S,)&0D9"2<G"1LS"2<G"2<G"2<G"E(Q- D."1MJ/@D;:CX))R<))R<)
  402. XM)R<))R<))R<*4C$U"1@8"1MJ>0D;:GD))R<)& T))R<))R<))R<*3$5&5 DG
  403. XM)PDG)PDG)PDG)PD;-25C)6,))R<))R<))R<*34E$1$Q%"2<G"2<G"2<G"2<G
  404. XK"2<G"2<G"2<G"2<G"E))1TA4"2<G"2<G"2<G"2<G"2<G"2<G"2<G"2<G"B<G
  405. Xend
  406. END_OF_FILE
  407. if test 2823 -ne `wc -c <'samples/keytool.defaults.uu'`; then
  408.     echo shar: \"'samples/keytool.defaults.uu'\" unpacked with wrong size!
  409. fi
  410. # end of 'samples/keytool.defaults.uu'
  411. fi
  412. if test -f 'samples/lpq2.tt' -a "${1}" != "-c" ; then 
  413.   echo shar: Will not clobber existing file \"'samples/lpq2.tt'\"
  414. else
  415. echo shar: Extracting \"'samples/lpq2.tt'\" \(5436 characters\)
  416. sed "s/^X//" >'samples/lpq2.tt' <<'END_OF_FILE'
  417. X#define        TRUE        1
  418. X#define        FALSE        0
  419. X
  420. X#define        HEIGHT        10
  421. X
  422. X#define        EMPTY_COUNT    6
  423. X
  424. X#define        CLEAR        "^L"
  425. X#define        BOLD_ON        "\e[7m"
  426. X#define        BOLD_OFF    "\e[m"
  427. X
  428. Xapplication "/bin/cat"
  429. X   label "<< Print Queue Monitor >>"
  430. X   size HEIGHT by 80 characters
  431. X   icon "laserwriter.icon"
  432. X   font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
  433. X   initialize {
  434. X      interval = active_interval;    /* set the timer rate for queue checking        */
  435. X      active = TRUE;            /* start out in active mode                */
  436. X      active_count = EMPTY_COUNT;    /* successive empty queues before we switch to idle    */
  437. X      delimiters = "\n";        /* to tokenize the output of lpq            */
  438. X      pr_name[0] = "lw";        /* define the printers we can access            */
  439. X      pr_name[1] = "lp";
  440. X      pr_name[2] = "versatec";
  441. X      close_on_idle = TRUE;        /* initial option choices                */
  442. X      close_option = 0;
  443. X      open_on_active = FALSE;
  444. X      open_option = 1;
  445. X      remove idle_light;        /* initialize the main window display            */
  446. X      remove check_light;
  447. X      remove remove_options_button;
  448. X      display display_options_button;
  449. X      }
  450. X   open {
  451. X      active = TRUE;
  452. X      interval = active_interval;
  453. X      display active_light;
  454. X      remove idle_light;
  455. X      active_count = EMPTY_COUNT;
  456. X      }
  457. X   close {
  458. X      active = FALSE;
  459. X      interval = idle_interval;
  460. X      display idle_light;
  461. X      remove active_light;
  462. X      active_count = 0;
  463. X      }
  464. X   timer {
  465. X      remove active_light;
  466. X      remove idle_light;
  467. X      display check_light;
  468. X      queue = tokenize(output_of(format("lpq -P%s", pr_name[printer])));
  469. X      remove check_light;
  470. X      send CLEAR, BOLD_ON, queue[0], BOLD_OFF, "\n\n";
  471. X      if (queue[0] == "no entries")
  472. X         if (active)
  473. X            if (--active_count == 0) {
  474. X               active = FALSE;
  475. X               display idle_light;
  476. X               interval = idle_interval;
  477. X               if (close_on_idle && is_open())
  478. X                  close;
  479. X               }
  480. X            else
  481. X               display active_light;
  482. X         else
  483. X            display idle_light;
  484. X      else {
  485. X         active = TRUE;
  486. X         active_count = EMPTY_COUNT;
  487. X         display active_light;
  488. X         interval = active_interval;
  489. X         if (open_on_active && !is_open())
  490. X            open;
  491. X         for (i = 1; i < HEIGHT - 1 && i < cardinality(queue); i++)
  492. X            if (index(queue[i], user()))
  493. X               send BOLD_ON, queue[i], BOLD_OFF, "\n";
  494. X            else
  495. X               send queue[i], "\n";
  496. X         }
  497. X      }
  498. X
  499. Xgadgets
  500. X   top
  501. X   align middle
  502. X   font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  503. X   label active_light
  504. X      at 49 4
  505. X      "Active"
  506. X   end_label
  507. X   label idle_light
  508. X      at 303 4
  509. X      "Idle"
  510. X   end_label
  511. X   label check_light
  512. X      at 529 4
  513. X      "Checking"
  514. X   end_label
  515. X   button
  516. X      at 4 24
  517. X      normal "   Go Active   " /* spaces set size of all buttons */
  518. X         { active = TRUE;
  519. X            interval = active_interval;
  520. X            remove idle_light;
  521. X            display active_light;
  522. X             active_count = EMPTY_COUNT;
  523. X           }
  524. X   end_button
  525. X   button
  526. X      at 249 24
  527. X      normal "Go Idle"
  528. X         { active = FALSE;
  529. X             interval = idle_interval;
  530. X             remove active_light;
  531. X             display idle_light;
  532. X             active_count = 0;
  533. X             if (close_on_idle)
  534. X                close;
  535. X           }
  536. X   end_button
  537. X   button display_options_button
  538. X      at 493 24
  539. X      normal "Options"
  540. X         display option_dialog;
  541. X   end_button
  542. X   button remove_options_button
  543. X      at 493 24
  544. X      normal "Remove Options"
  545. X         remove option_dialog;
  546. X   end_button
  547. Xend_gadgets
  548. X
  549. Xdialog option_dialog
  550. X   label "<< Print Queue Monitor Options >>"
  551. X   size 24 by 92 characters
  552. X   open {
  553. X         remove display_options_button;
  554. X         display remove_options_button;
  555. X         }
  556. X   close {
  557. X         remove remove_options_button;
  558. X         display display_options_button;
  559. X         }
  560. X   gadgets
  561. X      align middle
  562. X      font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  563. X      slider active_interval
  564. X         at 4 78
  565. X         label "Active Interval:"
  566. X         value on 
  567. X         range off
  568. X         minimum 5
  569. X         maximum 300
  570. X         initial 10
  571. X         width 100
  572. X         action {
  573. X            if (active)
  574. X               interval = active_interval;
  575. X            }
  576. X      end_slider
  577. X      slider idle_interval
  578. X         at 4 116
  579. X         label "Idle Interval:  "
  580. X         value on 
  581. X         range off
  582. X         minimum 5
  583. X         maximum 300
  584. X         initial 60
  585. X         width 100
  586. X         action {
  587. X            if (!active)
  588. X               interval = idle_interval;
  589. X            }
  590. X      end_slider
  591. X      choice printer
  592. X         at 4 4
  593. X         display vertical
  594. X         label "Printer:"
  595. X         "LaserWriter"        nothing;
  596. X         "Line Printer"        nothing;
  597. X         "Versatec Plotter"    nothing;
  598. X      end_choice
  599. X      label
  600. X         at 320 4
  601. X         "When the queue becomes active..."
  602. X      end_label
  603. X      choice open_option
  604. X         at 345 24
  605. X         display vertical
  606. X         "Open the window"            open_on_active = TRUE;
  607. X         "Do not change the window's status"    open_on_active = FALSE;
  608. X      end_choice
  609. X      label
  610. X         at 320 78
  611. X         "When the queue becomes idle..."
  612. X      end_label
  613. X      choice close_option
  614. X         at 345 98
  615. X         display vertical
  616. X         "Close the window"            close_on_idle = TRUE;
  617. X         "Do not change the window's status"    close_on_idle = FALSE;
  618. X      end_choice
  619. X   end_gadgets
  620. Xend_dialog
  621. X
  622. Xkeys
  623. X   disable normal_keys
  624. X   disable function_keys
  625. Xend_keys
  626. END_OF_FILE
  627. if test 5436 -ne `wc -c <'samples/lpq2.tt'`; then
  628.     echo shar: \"'samples/lpq2.tt'\" unpacked with wrong size!
  629. fi
  630. # end of 'samples/lpq2.tt'
  631. fi
  632. if test -f 'samples/top.tt' -a "${1}" != "-c" ; then 
  633.   echo shar: Will not clobber existing file \"'samples/top.tt'\"
  634. else
  635. echo shar: Extracting \"'samples/top.tt'\" \(4324 characters\)
  636. sed "s/^X//" >'samples/top.tt' <<'END_OF_FILE'
  637. Xapplication "top"
  638. X   size 16 by 80 characters
  639. X   font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  640. X   icon "top.icon"
  641. X   label "<< Top >>"
  642. X   at 156 0
  643. X   close "s1000\n"
  644. X   open "s5\n"
  645. Xgadgets
  646. X   top
  647. X   align middle
  648. X   font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  649. X   button
  650. X      normal    "Close"        close;
  651. X      shift    "Exit"        send "q";
  652. X   end_button
  653. X   slider interval
  654. X      label "Display Interval:"
  655. X      range off
  656. X      value on
  657. X      initial 5
  658. X      minimum 1
  659. X      maximum 240
  660. X      width 227
  661. X      action send format("s%d\n", interval);
  662. X   end_slider
  663. X   button
  664. X      normal    "Kill a Process"    display kill_process_dialog;
  665. X   end_button
  666. X   button
  667. X      normal    " Change Process Priority "    display change_process_dialog;
  668. X   end_button
  669. X   button
  670. X      normal    "Show Errors"    send "e";
  671. X   end_button
  672. Xend_gadgets
  673. Xdialog kill_process_dialog
  674. X   size 24 by 50 characters
  675. X   gadgets
  676. X      align middle
  677. X      font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  678. X      label
  679. X         "Enter the pid of the process to be killed"
  680. X      end_label
  681. X      button
  682. X         normal    "OK"    { if (verify(kill_pid, "0123456789")) {
  683. X                      send format("k%d\n", kill_pid);
  684. X                      remove kill_process_dialog;
  685. X                      }
  686. X                   else
  687. X                      popup invalid_pid;
  688. X                 }
  689. X      end_button
  690. X      text kill_pid
  691. X         label "Pid:"
  692. X         font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
  693. X         trigger "\n\r"
  694. X         display 20
  695. X         action { if (verify(kill_pid, "0123456789")) {
  696. X                  send format("k%d\n", kill_pid);
  697. X                  remove kill_process_dialog;
  698. X                  }
  699. X               else
  700. X                  popup invalid_pid;
  701. X             }
  702. X      end_text
  703. X      button
  704. X         normal "Cancel" remove kill_process_dialog;
  705. X      end_button
  706. X   end_gadgets
  707. Xend_dialog
  708. Xdialog change_process_dialog
  709. X   size 24 by 60 characters
  710. X   gadgets
  711. X      align middle
  712. X      font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  713. X      label
  714. X         "Enter the pid of the process, and its new priority"
  715. X      end_label
  716. X      button
  717. X         normal    "OK"    { if (verify(change_pid, "0123456789"))
  718. X                      if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
  719. X                         send format("r%d %d\n", priority, change_pid);
  720. X                         remove change_process_dialog;
  721. X                         }
  722. X                      else
  723. X                         popup invalid_priority;
  724. X                   else
  725. X                      popup invalid_pid;
  726. X                 }
  727. X      end_button
  728. X      text change_pid
  729. X         label "Pid:"
  730. X         font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
  731. X         trigger "\n\r"
  732. X         display 10
  733. X         action { if (verify(change_pid, "0123456789"))
  734. X                  if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
  735. X                     send format("r%d %d\n", priority, change_pid);
  736. X                     remove change_process_dialog;
  737. X                     }
  738. X                  else
  739. X                     popup invalid_priority;
  740. X               else
  741. X                  popup invalid_pid;
  742. X             }
  743. X      end_text
  744. X      text priority
  745. X         label "Priority:"
  746. X         font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
  747. X         trigger "\n\r"
  748. X         display 10
  749. X         action { if (verify(change_pid, "0123456789"))
  750. X                  if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
  751. X                     send format("r%d %d\n", priority, change_pid);
  752. X                     remove change_process_dialog;
  753. X                     }
  754. X                  else
  755. X                     popup invalid_priority;
  756. X               else
  757. X                  popup invalid_pid;
  758. X             }
  759. X      end_text
  760. X      button
  761. X         normal "Cancel" remove change_process_dialog;
  762. X      end_button
  763. X   end_gadgets
  764. Xend_dialog
  765. Xdialog invalid_pid
  766. X   gadgets
  767. X      font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  768. X      align middle
  769. X      ragged
  770. X      label
  771. X         "The specified pid is not valid   "
  772. X      end_label
  773. X      button
  774. X         normal "  OK  " remove invalid_pid;
  775. X      end_button
  776. X   end_gadgets
  777. Xend_dialog
  778. Xdialog invalid_priority
  779. X   gadgets
  780. X      font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  781. X      align middle
  782. X      ragged
  783. X      label
  784. X         "The specified priority is not valid   "
  785. X      end_label
  786. X      button
  787. X         normal "  OK  " remove invalid_priority;
  788. X      end_button
  789. X   end_gadgets
  790. Xend_dialog
  791. END_OF_FILE
  792. if test 4324 -ne `wc -c <'samples/top.tt'`; then
  793.     echo shar: \"'samples/top.tt'\" unpacked with wrong size!
  794. fi
  795. # end of 'samples/top.tt'
  796. fi
  797. if test -f 'samples/vt100/edtkeys.ras.uu' -a "${1}" != "-c" ; then 
  798.   echo shar: Will not clobber existing file \"'samples/vt100/edtkeys.ras.uu'\"
  799. else
  800. echo shar: Extracting \"'samples/vt100/edtkeys.ras.uu'\" \(4440 characters\)
  801. sed "s/^X//" >'samples/vt100/edtkeys.ras.uu' <<'END_OF_FILE'
  802. Xbegin 644 edtkeys.ras
  803. XM6:9JE0   +P   "$     0  #&     !                            
  804. XM                                               /____________
  805. XM_________________X (      !       (      !       ( (      ! 
  806. XM      (      !       ( (      ! ';[CP ( ?S;? !!Y]P!P ( (    
  807. XM  ! "1)!( ( )9*5 ! DD@ @ ( (      ! "1!!( ( (9*$ ! D@@ @ ( (
  808. XM      ! #QQ!( ( .5$$ ! DX@ @ ( (      ! "1!!P ( (5$$ ! D@@ @
  809. XM ( (      ! "1!!  ( (3*$ ! D@@ @ ( (      ! "1))  ( (3*$ ! D
  810. XMDD D ( (      ! ';[[@ ( <Q;. !!Y]\!\ ( (      !       (     
  811. XM !       ( (      !       (      !       ( ('QSQ\ !       ( 
  812. XM     !       ( (,R9@V !       (      !       ( (,&9@V !     
  813. XM  ( ?O\[X!#OG? '@( (,&9@V !       ( ,C$1L!!DB-@# ( (-V9@V ! 
  814. XM      ( ,#&1L!!DR-@# ( (,V9@V !       ( /#'1L!!DZ-@# ( (,V1D
  815. XMV !       ( ,#'QL!!D^-@# ( ('CC]\ !       ( ,#%QL!!DN-@# ( (
  816. XM      !       ( ,#$QL!!DF-@#(( (      !       ( >/^3X! YR? '
  817. XMX( (      !       (      !       ( (      !       (      !  
  818. XM     ( (      !       (      !       ( /____________________
  819. XM_________X (      !       (      !       ( (      !       ( 
  820. XM     !       ( ( >,/? ! ![Y[X (&///YO!!Y]P#L ( ( )$1) ! ")**
  821. XMH ("$DDLDA DD@!$ ( ( ),0( ! "!" @ (&$DD,DA D@@!$ ( ( )*0. ! 
  822. XM!AR @ (%$DG*DA DX@!4 ( ( .*3( !  1" @ (%''$*DA D@@!4 ( ( (>1
  823. XM( !  )" @ (/$$$)DA D@@ H ( ( (21) ! ")*(@ ()$$$IDA DDD H ( (
  824. XM <S.? ! #SYQP (9N./XO!!Y]\ H ( (      !       (      !      
  825. XM ( (      !       (      !       ( (      !       (      !  
  826. XM     ( (      !       (      !       ( ('QV/.^! '[]X\ (!\_?/
  827. XM !#OG? .X( (,R:)$;! #(PP8 ( V9-F !!DB-@$0( (,&;9D;! # PP8 ( 
  828. XMV8-F !!DR-@%0( (,&;9T;! #PPP8 ( V>-F !!DZ-@%0( (,&;Y\;! # PP
  829. XM8 ( \8/& !!D^-@'P( (,&:I<;! # PP8 ( V8,& !!DN-@"@( (,V2I,;! 
  830. XM# PR9 ( V9,&0!!DF-@"@( ('CF/D^! 'C]^_ (!V_>/P! YR? "@( (    
  831. XM  !       (      !       ( (      !       (      !       (P(
  832. XM      !       (      !       (@(      !       (      !      
  833. XM (@/_____________________________X@(      !       (      !  
  834. XM     (@(      !       (      !       (@(&/=IGOA!XP]OMX(  ?V^
  835. XM !!Y]P \ (D("$HLHDA D1$I(D(  BDJ ! DD@!$ (\(&$HLH$! DQ Q(D( 
  836. XM @D( ! D@@!  ( (%$E*H'! XI Q(D(  @D( ! DX@!  ( (%$E*H$! DI I
  837. XM(X(  @D( ! D@@!  ( (/$E)H$! EY I(@(  @D( ! D@@!  ( ()$B)HDA 
  838. XME)$E(@(  BD( ! DDD!$ (\(9O"8G/A![,YLQP(  <8< !!Y]\ X ( (    
  839. XM  !       (      !       ( (      !       (      !       (\(
  840. XM/AS]_C! #\<^  (/CAY^_!#OG? #X(4(&R:U:B! "TF;  (&QC):9!!DB-@&
  841. XM8(0(&V8P8V!  QF;  (&QS 88!!DR-@& (0('F8P8V!  QF;  (&S1P8>!!D
  842. XMZ-@& (0(&V8P8^!  QF>  ('B0888!!D^-@& (0(&V8P8J!  QF8  (&'X88
  843. XM8!!DN-@& (0(&V0P8J!  QD8  (&&:889!!DF-@&8(X(/CAX]C! !XX\  (/
  844. XM.;P\_! YR? #P( (      !       (      !       ( (      !     
  845. XM  (      !       ( (      !       (      !       ( (      ! 
  846. XM      (      !       ( /_____________________________X (    
  847. XM  !       (      !       ( (      !       (      !       (\(
  848. XM [.>> !  'SG  ( /[,> !!\ @   (T( 19)) !  "62  ( 12$) ! D @  
  849. XM (P( 11)) !  "$2  ( 02,) ! BQXQL (P( 51)) !  #D2  ( 0>*) ! Y
  850. XM(A(T (P( 51.) !  "$2  ( 02*. ! A(AX@ (P( *1*) !  "$2  ( 02>*
  851. XM ! A(A @ (P( *3)) !  "4R0 ( 122) ! E(A(@ (X( *.9> !  'SGP ( 
  852. XM.[S9 !!_L8QP ( (      !       (      !       ( (      !     
  853. XM  (      !       ( ( #YP\_!^?@'XYX(  /\YX! ]W?'@ ( ( &8QD9 ;
  854. XM,@#),P(  #$3(!!DR-L@ (\(.V Y@8 ;, ##,P( =C&3 !!@R-L  ( (&F!H
  855. XMX> ;/ #S,P( -#'1P! XR/'  ( (#&!(,8 ;, ##,P( &#'P8! ,R-A@ (\(
  856. XM#&#\,8 ;, ##,P( &#%P8! ,R-A@ (0(%F;-,9 ;,@#+(R( +#$R8!!,R-I@
  857. XM (0(-SW-X_ ^?@'YQ^( ;O^3P!!X<?/  (0(              (      !  
  858. XM     (<(              (      !       (4(              (     
  859. XM !       (0(      !       (      !       (P/________________
  860. XM_____________X (      !       (      !         (      !     
  861. XM  (      !         ( <?S? !       ('ON/GOA         ( ($9) ! 
  862. XM      ((DD$HJA         ( ($9( !       (($$$("!         ( ($5
  863. XM. !       (&'$'("!         ( ($5( !       (!$$$("!        P(
  864. XM ($3( !       ( D$$("!        D( )$3) !       ((DDDHB!      
  865. XM  D( ??Q? !       (//OOG'!        @(      !       (      !  
  866. XM      @(      !       (      !        @( '/G^<!       (/GYY^
  867. XM_!        D( )FS*(!       (&S+(RM!        D( 9FS#(!       (&
  868. XMS# P,!         ( 9FSSH!       (&SQP\,!         ( 9GC#X!     
  869. XM  ('C 8P,!         ( 9F#"X!       (&S 8P,!         ( 9&#*8! 
  870. XM      (&S*8R,!        \( ./'_(!       (.W[Q^>!         (    
  871. XM  !       (      !         (      !       (      !        ,(
  872. XM      !       (      !        0(      !       (      !      
  873. XM  0/_______       /_______        0                         
  874. X%      3_
  875. Xend
  876. END_OF_FILE
  877. if test 4440 -ne `wc -c <'samples/vt100/edtkeys.ras.uu'`; then
  878.     echo shar: \"'samples/vt100/edtkeys.ras.uu'\" unpacked with wrong size!
  879. fi
  880. # end of 'samples/vt100/edtkeys.ras.uu'
  881. fi
  882. if test -f 'samples/vt100/vt102tool.tt' -a "${1}" != "-c" ; then 
  883.   echo shar: Will not clobber existing file \"'samples/vt100/vt102tool.tt'\"
  884. else
  885. echo shar: Extracting \"'samples/vt100/vt102tool.tt'\" \(3707 characters\)
  886. sed "s/^X//" >'samples/vt100/vt102tool.tt' <<'END_OF_FILE'
  887. X/*
  888. X * simple tooltool command file for creating a vt100 emulator with
  889. X * standard VT100 keypad (plus a few from VT320), plus a keyboard template.
  890. X * standard templates are provided for EDT and ANU News.  More could be
  891. X * added.  This was a quick hack, and needs further work.
  892. X * See also vttool, which is a standalone vtem wrapper providing similar
  893. X * functionality.
  894. X *
  895. X * Last edit:  8 April 1989 by jqj@hogg.cc.uoregon.edu
  896. X */
  897. X
  898. Xapplication "vtem"
  899. X    label "vt102tool"
  900. X    size 24 by 81 characters
  901. X    initialize    {remove EDThelp;}
  902. X    icon "/usr/local/images/vt.icon"
  903. Xgadgets
  904. X    /* place the keypad at the bottom */
  905. X    bottom
  906. X    align top
  907. X    ragged
  908. X    /* unfortunately, we are forced to hardwire the font */
  909. X    /* since we are hardwiring the locations of buttons */
  910. X    font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"
  911. X#define ROW_1    5
  912. X#define ROW_2    30
  913. X#define ROW_3    55
  914. X#define ROW_4    80
  915. X#define ROW_5    105
  916. X#define COL_1    5
  917. X#define COL_2    54
  918. X#define COL_3    103
  919. X#define COL_4    152
  920. X#define COL_5    201
  921. X#define COL_6    250
  922. X#define COL_7    299
  923. X#define COL_8    348
  924. X#define COL_9    397        /* unused */
  925. X#define COL_10    446        /* unused */
  926. X
  927. X    button PF1
  928. X    at COL_1 ROW_1
  929. X    normal "PF1"    send "\eOP";
  930. X    end_button
  931. X    button PF2
  932. X    at COL_2 ROW_1
  933. X    normal "PF2"    send "\eOQ";
  934. X    end_button
  935. X    button PF3
  936. X    at COL_3 ROW_1
  937. X    normal "PF3"    send "\eOR";
  938. X    end_button
  939. X    button PF4
  940. X    at COL_4 ROW_1
  941. X    normal "PF4"    send "\eOS";
  942. X    end_button
  943. X    button n7
  944. X    at COL_1 ROW_2
  945. X    normal "7"    send "\eOw";
  946. X    end_button
  947. X    button n8
  948. X    at COL_2 ROW_2
  949. X    normal "8"    send "\eOx";
  950. X    end_button
  951. X    button n9
  952. X    at COL_3 ROW_2
  953. X    normal "9"    send "\eOy";
  954. X    end_button
  955. X    button minus
  956. X    at COL_4 ROW_2
  957. X    normal "-"    send "\eOm";
  958. X    end_button
  959. X    button n4
  960. X    at COL_1 ROW_3
  961. X    normal "4"    send "\eOt";
  962. X    end_button
  963. X    button n5
  964. X    at COL_2 ROW_3
  965. X    normal "5"    send "\eOu";
  966. X    end_button
  967. X    button n6
  968. X    at COL_3 ROW_3
  969. X    normal "6"    send "\eOv";
  970. X    end_button
  971. X    button comma
  972. X    at COL_4 ROW_3
  973. X    normal ","    send "\eOl";
  974. X    end_button
  975. X    button n1
  976. X    at COL_1 ROW_4
  977. X    normal "1"    send "\eOq";
  978. X    end_button
  979. X    button n2
  980. X    at COL_2 ROW_4
  981. X    normal "2"    send "\eOr";
  982. X    end_button
  983. X    button n3
  984. X    at COL_3 ROW_4
  985. X    normal "3"    send "\eOs";
  986. X    end_button
  987. X    button ENTER
  988. X    at COL_4 ROW_4
  989. X    normal "Ent"    send "\eOM";
  990. X    end_button
  991. X    button n0
  992. X    at COL_1 ROW_5
  993. X    normal "0"    send "\eOp";
  994. X    end_button
  995. X    button period
  996. X    at COL_3 ROW_5
  997. X    normal "."    send "\eOn";
  998. X    end_button
  999. X    
  1000. X    /* some VT320 extended keys */
  1001. X    button FindKey
  1002. X    at COL_5 ROW_2
  1003. X    normal "Find"    send "\e[1~";
  1004. X    end_button
  1005. X    button InsertKey
  1006. X    at COL_6 ROW_2
  1007. X    normal "Ins."    send "\e[2~";
  1008. X    end_button
  1009. X    button RemoveKey
  1010. X    at COL_7 ROW_2
  1011. X    normal "Rem."    send "\e[3~";
  1012. X    end_button
  1013. X    button SelectKey
  1014. X    at COL_5 ROW_3
  1015. X    normal "Sel."    send "\e[4~";
  1016. X    end_button
  1017. X    button PrevScreenKey
  1018. X    at COL_6 ROW_3
  1019. X    normal "Prev"    send "\e[5~";
  1020. X    end_button
  1021. X    button NextScreenKey
  1022. X    at COL_7 ROW_3
  1023. X    normal "Next"    send "\e[6~";
  1024. X    end_button
  1025. X
  1026. X    /* arrow keys */
  1027. X    button uparrow
  1028. X    at COL_6 ROW_4
  1029. X    normal "\136"    send "\e[A";
  1030. X    end_button
  1031. X    button leftarrow
  1032. X    at COL_5 ROW_5
  1033. X    normal "<"    send "\e[D";
  1034. X    end_button
  1035. X    button rightarrow
  1036. X    at COL_7 ROW_5
  1037. X    normal ">"    send "\e[C";
  1038. X    end_button
  1039. X    button downarrow
  1040. X    at COL_6 ROW_5
  1041. X    normal "V"    send "\e[B";
  1042. X    end_button
  1043. X    
  1044. X    /* keypad templates.  Only one will be visible at a time. */
  1045. X    label NEWShelp
  1046. X        at COL_8 1
  1047. X    '/usr/local/images/newskeys.ras'
  1048. X    end_label
  1049. X    label EDThelp
  1050. X        at COL_8 1
  1051. X        '/usr/local/images/edtkeys.ras'
  1052. X    end_label
  1053. X    
  1054. X    choice helplabel
  1055. X        at COL_5 ROW_1
  1056. X        display cycle
  1057. X        label " help:"
  1058. X        "ANU News"    {remove EDThelp; display NEWShelp;}
  1059. X        "EDT"        {remove NEWShelp; display EDThelp;}
  1060. X    end_choice
  1061. X
  1062. Xend_gadgets
  1063. END_OF_FILE
  1064. if test 3707 -ne `wc -c <'samples/vt100/vt102tool.tt'`; then
  1065.     echo shar: \"'samples/vt100/vt102tool.tt'\" unpacked with wrong size!
  1066. fi
  1067. # end of 'samples/vt100/vt102tool.tt'
  1068. fi
  1069. if test -f 'samples/vt100/vtem.c' -a "${1}" != "-c" ; then 
  1070.   echo shar: Will not clobber existing file \"'samples/vt100/vtem.c'\"
  1071. else
  1072. echo shar: Extracting \"'samples/vt100/vtem.c'\" \(4952 characters\)
  1073. sed "s/^X//" >'samples/vt100/vtem.c' <<'END_OF_FILE'
  1074. X/*
  1075. X * vtem - A termcap driven VT100 emulator for BSD Unix
  1076. X *
  1077. X * $Header: /home/src/local/vttool/vtem.c,v 1.2 89/02/07 14:20:13 jqj Exp $
  1078. X *
  1079. X * Public domain software.
  1080. X * Written by Leif Samuelsson (lsamuelsson@erisun) in December, 1985
  1081. X * 
  1082. X * History:
  1083. X *
  1084. X * $Log:    vtem.c,v $
  1085. X * Revision 1.2  89/02/07  14:20:13  jqj
  1086. X * Major revision of vtem to support more complete VT100 emulation.  Most
  1087. X * changes are to out.c.  Changes to this module include:
  1088. X * 1/ get termcap data before setupterm() so that TI gets called properly
  1089. X *    (needed for Sun cmdtool to turn off scroll bar).
  1090. X * 2/ support for varying TERM values (this may be a bad idea since old copies
  1091. X *    of /etc/termcap did not include a vt102 entry).
  1092. X * 
  1093. X * 1988-02-10    Version 1.1+gnu1+bgb - added ability to pass parameters
  1094. X *        to the shell process
  1095. X *
  1096. X * 1987-07-01    Version 1.1+gnu1.  Bug fixes for setting tabs in column
  1097. X *        81 (crashes when you run 'reset'), and for setting the
  1098. X *        environment variables TERM and TERMCAP.
  1099. X *
  1100. X * 1986-04-25    Version 1.1 posted to net.sources. This version contains
  1101. X *        bug fixes and some new code for simulating semi-graphics.
  1102. X *
  1103. X * 1986-01-30    Version 1.0 posted to mod.sources
  1104. X */
  1105. X
  1106. X#include "vtem.h"
  1107. X#include <sys/wait.h>
  1108. X#include <sys/param.h>
  1109. X
  1110. Xint master, slave, child;
  1111. Xchar linec, linen;
  1112. Xchar    arg_list[NCARGS];
  1113. Xchar    *Argv[4];
  1114. X
  1115. X/* suggestion from Marcus Moehrmann <marcus@fkihh.UUCP>
  1116. X   so this works witn SunOS 3.0 */
  1117. X#ifdef SUN30
  1118. X#define putenv(STRING) 1
  1119. X#endif
  1120. X
  1121. Xdone()
  1122. X{
  1123. Xunion wait status;
  1124. X
  1125. X    if (wait3(&status, WNOHANG, 0) != child)
  1126. X        return;
  1127. X    setupterm(0);
  1128. X    exit(0);
  1129. X}
  1130. X
  1131. Xmain(argc, argv)
  1132. X    int             argc;
  1133. X    char          **argv;
  1134. X{
  1135. X    int    i;
  1136. X    /* allocate enough space for the argument list */
  1137. X    /* - that is - Argv                            */
  1138. X    /* reserve two  parameters for the begining    */
  1139. X    /* first = tail of shell                       */
  1140. X    /* second = "-i"  -> interactive mode          */
  1141. X    /* third  = "-c"  -> argument list is command  */
  1142. X    /* forth - the string with one or more arguments */
  1143. X    /* NOTE - args 3 and 4 may be nil              */
  1144. X
  1145. X
  1146. X/* Argv[0] will be filled in later -see use of the tail variable */
  1147. X    if ( argc > 1 ) /* then we have to pass arguments to a subshell */ {
  1148. X    Argv[1] = "-c";
  1149. X    Argv[2] = arg_list;
  1150. X    for (i=1;i<argc;i++) {
  1151. X        strcat(arg_list,*(argv+i)); strcat(arg_list," ");
  1152. X    }
  1153. X    Argv[3] = (char *) 0;
  1154. X    } else {
  1155. X    Argv[1] = "-i";
  1156. X    Argv[2] = (char *) 0;
  1157. X    }
  1158. X
  1159. X    /* Start three processes, one for input, one for output
  1160. X         * and one shell.
  1161. X         */
  1162. X    setup_master();
  1163. X    gettermtype();        /* do this before setupterm! */
  1164. X    setupterm(TRUE);
  1165. X    signal(SIGCHLD, done);
  1166. X    if (child = fork())
  1167. X        handle_input();
  1168. X    else {
  1169. X        if (fork())
  1170. X        handle_output();
  1171. X        else
  1172. X        start_shell();
  1173. X    }
  1174. X}
  1175. X
  1176. Xhandle_input()
  1177. X{
  1178. Xchar buf[BUFSIZ];
  1179. Xint i;
  1180. X
  1181. X    while (i = read(0, buf, BUFSIZ))
  1182. X        write(master, buf, i);
  1183. X    setupterm(0);
  1184. X    exit(0);
  1185. X}
  1186. X
  1187. X
  1188. Xstart_shell()
  1189. X{
  1190. Xint t;
  1191. Xchar *term, *getenv(), *shell, *tail, *rindex();
  1192. X
  1193. X    switch (vttype) {
  1194. X        case VT52:    term = "TERM=vt52"; break;
  1195. X        default:
  1196. X        case VT100:    term = "TERM=vt100"; break;
  1197. X        case VT102:    term = "TERM=vt102"; break;
  1198. X    }
  1199. X    if (0 != putenv(term))
  1200. X        fprintf(stderr, "Set terminal type to \"%s\" manually.\r\n",
  1201. X            term);
  1202. X    term = getenv("TERMCAP");
  1203. X    if (term && term[0] != '/') {
  1204. X        /* TERMCAP contains a termcap entry for the old terminal
  1205. X         * type.  Kill it.  We would not have to do this if termcap
  1206. X         * didn't have the bug that if TERMCAP is specified and
  1207. X         * the TERM value is not found in it, /etc/termcap is not
  1208. X         * searched.
  1209. X         */
  1210. X        if (0 != putenv("TERMCAP="))
  1211. X            fprintf(stderr, "Unset TERMCAP manually.\r\n");
  1212. X    }
  1213. X            
  1214. X    /* Then fork the shell
  1215. X     */
  1216. X    if ((shell = getenv("SHELL")) == (char *) 0)
  1217. X        shell = "/bin/sh";
  1218. X    if ((tail = rindex(shell, '/')) == (char *) 0)
  1219. X        tail = "sh";
  1220. X    else
  1221. X        tail++;
  1222. X    if ((t = open("/dev/tty", 2)) >= 0) {
  1223. X        ioctl(t, TIOCNOTTY, (char *)0);
  1224. X        close(t);
  1225. X    }
  1226. X    setup_slave();
  1227. X    close(master);
  1228. X    dup2(slave, 0);
  1229. X    dup2(slave, 1);
  1230. X    dup2(slave, 2);
  1231. X    close(slave);
  1232. X/* now construct an array for exec */
  1233. X        Argv[0] = tail;
  1234. X        execv(shell, Argv );
  1235. X    perror(shell);
  1236. X    fail();
  1237. X}
  1238. X
  1239. Xfail()
  1240. X{
  1241. X    kill(0, SIGTERM);
  1242. X    setupterm(0);
  1243. X    exit(0);
  1244. X}
  1245. X
  1246. X
  1247. Xsetup_master()
  1248. X{
  1249. Xchar line[11];
  1250. X
  1251. X    for (linec = 'p'; linec <= 's'; linec++) {
  1252. X    sprintf(line, "/dev/pty%c0", linec);
  1253. X    if (access(line, 0) != 0)
  1254. X        break;
  1255. X    for (linen = 0; linen < 16; linen++) {
  1256. X        sprintf(line, "/dev/pty%c%1x", linec, linen);
  1257. X        master = open(line, 2);
  1258. X        if (master >= 0) {
  1259. X        return;
  1260. X        }
  1261. X    }
  1262. X    }
  1263. X    fprintf(stderr, "Can't find a pty\n");
  1264. X    fail();
  1265. X}
  1266. X
  1267. Xsetup_slave()
  1268. X{
  1269. Xchar line[11];
  1270. X
  1271. X    sprintf(line, "/dev/tty%c%1x", linec, linen);
  1272. X    slave = open(line, 2);
  1273. X    if (slave < 0) {
  1274. X    perror(line);
  1275. X    fail();
  1276. X    }
  1277. X    ioctl(slave, TIOCSETP, (char *)&oldb);
  1278. X    ioctl(slave, TIOCSETC, (char *)&oldtchars);
  1279. X    ioctl(slave, TIOCSLTC, (char *)&oldltchars);
  1280. X    ioctl(slave, TIOCLSET, (char *)&oldlb);
  1281. X    ioctl(slave, TIOCSETD, (char *)&oldl);
  1282. X}
  1283. END_OF_FILE
  1284. if test 4952 -ne `wc -c <'samples/vt100/vtem.c'`; then
  1285.     echo shar: \"'samples/vt100/vtem.c'\" unpacked with wrong size!
  1286. fi
  1287. # end of 'samples/vt100/vtem.c'
  1288. fi
  1289. if test -f 'symbols.c' -a "${1}" != "-c" ; then 
  1290.   echo shar: Will not clobber existing file \"'symbols.c'\"
  1291. else
  1292. echo shar: Extracting \"'symbols.c'\" \(3946 characters\)
  1293. sed "s/^X//" >'symbols.c' <<'END_OF_FILE'
  1294. X/************************************************************************/
  1295. X/*    Copyright 1988 by Chuck Musciano and Harris Corporation        */
  1296. X/*                                    */
  1297. X/*    Permission to use, copy, modify, and distribute this software    */
  1298. X/*    and its documentation for any purpose and without fee is    */
  1299. X/*    hereby granted, provided that the above copyright notice    */
  1300. X/*    appear in all copies and that both that copyright notice and    */
  1301. X/*    this permission notice appear in supporting documentation, and    */
  1302. X/*    that the name of Chuck Musciano and Harris Corporation not be    */
  1303. X/*    used in advertising or publicity pertaining to distribution    */
  1304. X/*    of the software without specific, written prior permission.    */
  1305. X/*    Chuck Musciano and Harris Corporation make no representations    */
  1306. X/*    about the suitability of this software for any purpose.  It is    */
  1307. X/*    provided "as is" without express or implied warranty.        */
  1308. X/*                                    */
  1309. X/*    The sale of any product based wholely or in part upon the     */
  1310. X/*    technology provided by tooltool is strictly forbidden without    */
  1311. X/*    specific, prior written permission from Harris Corporation.    */
  1312. X/*    Tooltool technology includes, but is not limited to, the source    */
  1313. X/*    code, executable binary files, specification language, and    */
  1314. X/*    sample specification files.                    */
  1315. X/************************************************************************/
  1316. X
  1317. X#include    <stdio.h>
  1318. X#include    <ctype.h>
  1319. X#include    <sys/types.h>
  1320. X#include    <sys/dir.h>
  1321. X#include    <pwd.h>
  1322. X
  1323. X#include    <suntool/sunview.h>
  1324. X#include    <suntool/icon_load.h>
  1325. X
  1326. X#include    "tooltool.h"
  1327. X
  1328. XPRIVATE    s_ptr    symbols = NULL;
  1329. X
  1330. X/************************************************************************/
  1331. XPRIVATE    s_ptr    create_symbol(name, sp)
  1332. X
  1333. Xchar    *name;
  1334. Xs_ptr    *sp;
  1335. X
  1336. X{
  1337. X    while (*sp)
  1338. X       if (strcmp(name, (*sp)->name) < 0)
  1339. X          sp = &((*sp)->left);
  1340. X       else
  1341. X          sp = &((*sp)->right);
  1342. X    *sp = (s_ptr) safe_malloc(sizeof(s_data));
  1343. X    (*sp)->name = strsave(name);
  1344. X    (*sp)->kind = SYMBOL_SYMBOL;
  1345. X    (*sp)->gadget = NULL;
  1346. X    (*sp)->dialog = NULL;
  1347. X    (*sp)->left = NULL;
  1348. X    (*sp)->right = NULL;
  1349. X    (*sp)->value = (v_ptr) safe_malloc(sizeof(v_data));
  1350. X    (*sp)->value->kind = V_NOTHING;
  1351. X    (*sp)->value->number = 0.0;
  1352. X    (*sp)->value->str = "";
  1353. X    (*sp)->value->value = NULL;
  1354. X    (*sp)->value->left = NULL;
  1355. X    (*sp)->value->right = NULL;
  1356. X    (*sp)->value->index = NULL;
  1357. X    return(*sp);
  1358. X}
  1359. X    
  1360. X/************************************************************************/
  1361. XEXPORT    s_ptr    tt_find_symbol(name)
  1362. X
  1363. Xchar    *name;
  1364. X
  1365. X{    s_ptr    s;
  1366. X    int    i;
  1367. X
  1368. X    for (s = symbols; s; )
  1369. X       if ((i = strcmp(name, s->name)) == 0)
  1370. X          break;
  1371. X       else if (i < 0)
  1372. X          s = s->left;
  1373. X       else
  1374. X          s = s->right;
  1375. X    if (s == NULL)
  1376. X       s = create_symbol(name, &symbols);
  1377. X    return(s);
  1378. X}
  1379. X
  1380. X/************************************************************************/
  1381. XEXPORT    v_ptr    tt_get_value(s)
  1382. X
  1383. Xs_ptr    s;
  1384. X
  1385. X{    v_ptr    v;
  1386. X    static    char    buf[20];
  1387. X
  1388. X    if (s == NULL)
  1389. X       return(NULL);
  1390. X    else if (s->kind == SYMBOL_SYMBOL)
  1391. X       return(s->value);
  1392. X    else if (s->kind == SYMBOL_DIALOG)
  1393. X       abend("attempted to get value of dialog box %s", s->name);
  1394. X    else {
  1395. X       switch (s->gadget->kind) {
  1396. X          case GADGET_TEXT   : v = tt_string_result(panel_get(s->gadget->panel_item, PANEL_VALUE));
  1397. X                      break;
  1398. X          case GADGET_CHOICE : 
  1399. X          case GADGET_SLIDER : v = tt_int_result(panel_get(s->gadget->panel_item, PANEL_VALUE));
  1400. X                      break;
  1401. X/*          case GADGET_LABEL  : v = tt_string_result(panel_get(s->gadget->panel_item, PANEL_LABEL_STRING));
  1402. X                         break;*/
  1403. X          default         : v = tt_int_result(0);
  1404. X          }
  1405. X       v->kind |= V_GADGET;
  1406. X       v->gadget = s->gadget;
  1407. X       return(v);
  1408. X       }
  1409. X}
  1410. X
  1411. X/************************************************************************/
  1412. XEXPORT    tt_make_intrinsic_symbols()
  1413. X
  1414. X{    s_ptr    interval;
  1415. X
  1416. X    tt_mouse_x = tt_find_symbol("mouse_x");
  1417. X    tt_mouse_y = tt_find_symbol("mouse_y");
  1418. X    interval = tt_find_symbol("interval");
  1419. X    interval->value->kind |= V_INTERVAL;
  1420. X    tt_delimiters = tt_find_symbol("delimiters");
  1421. X    tt_delimiters->value->kind = 0;
  1422. X    tt_delimiters->value->str = " \t\n\r\"'";
  1423. X}
  1424. END_OF_FILE
  1425. if test 3946 -ne `wc -c <'symbols.c'`; then
  1426.     echo shar: \"'symbols.c'\" unpacked with wrong size!
  1427. fi
  1428. # end of 'symbols.c'
  1429. fi
  1430. echo shar: End of archive 2 \(of 13\).
  1431. cp /dev/null ark2isdone
  1432. MISSING=""
  1433. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1434.     if test ! -f ark${I}isdone ; then
  1435.     MISSING="${MISSING} ${I}"
  1436.     fi
  1437. done
  1438. if test "${MISSING}" = "" ; then
  1439.     echo You have unpacked all 13 archives.
  1440.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1441. else
  1442.     echo You still need to unpack the following archives:
  1443.     echo "        " ${MISSING}
  1444. fi
  1445. ##  End of shell archive.
  1446. exit 0
  1447.  
  1448.  
  1449. Chuck Musciano            ARPA  : chuck@trantor.harris-atd.com
  1450. Harris Corporation         Usenet: ...!uunet!x102a!trantor!chuck
  1451. PO Box 37, MS 3A/1912        AT&T  : (407) 727-6131
  1452. Melbourne, FL 32902        FAX   : (407) 727-{5118,5227,4004}
  1453.